Test Series - java script

Test Number 43/92

Q: Which property helps to initiate the HTTP requests?
A. request
B. location
C. send
D. write
Solution: It is possible for JavaScript code to script HTTP, however. HTTP requests are initiated when a script sets the location property of a window object or calls the submit() method of a form object. The location object is part of the window object and is accessed through the window.location property.
Q: Which method is an alternative of the property location of a window object?
A. submit()
B. locate()
C. load()
D. write()
Solution: HTTP requests are initiated when a script sets the location property of a window object or calls the submit() method of a form object. In both cases, the browser loads a new page.
Q: Which of the following uses scripted HTTP?
A. XML
B. HTML
C. Ajax
D. CSS
Solution: AJAX stands for Asynchronous JavaScript And XML. The key feature of an Ajax application is that it uses scripted HTTP to initiate data exchange with a web server without causing pages to reload.
Q: Which of the below is a liberal reverse of Ajax?
A. HTTP
B. HTML
C. XML
D. Comet
Solution: Comet is the reverse of Ajax: in Comet, it is the web server that initiates the communication, asynchronously sending messages to the client. The big advantage of Comet is that each client always has a communication link open to the server.
Q: The other name for Comet is _____________
A. Server Push
B. Ajax Push
C. HTTP Streaming
D. All of the mentioned
Solution: Comet is a web application model where a request is sent to the server and kept alive for a long time, until a time-out or a server event occurs. Other names for Comet include “Server Push”, “Ajax Push”, “HTTP Streaming”.
Q: Which is the element that has a src property to initiate HTTP GET request?
A. img
B. iframe
C. script
D. both img and script
Solution: Both img and script contains the src property that can be set to initiate an HTTP GET request. The src property sets or returns the value of the src attribute of an image.The required src attribute specifies the URL of an image.
Q: XMLHttpRequest is a ____________
A. Object
B. Class
C. Both Object and Class
D. Array
Solution: XMLHttpRequest is both an object and a class. The XMLHttpRequest object can be used to request data from a web server.
Q: Which of the following are the features of an HTTP request?
A. URL being requested
B. Optional request body
C. Optional set of request headers
D. All of the mentioned
Solution: An HTTP request consists of four parts :
the HTTP request method or “verb”
the URL being requested
an optional set of request headers, which may include authentication information
an optional request body
Q: Which of the following is a feature of the HTTP response?
A. Mandatory response body
B. Optional response body
C. URL being released
D. Optional set of response headers
Solution: The HTTP response sent by a server has three parts :
a numeric and textual status code that indicates the success or failure of the request
a set of response headers
the response body
Q: Which is the appropriate code to begin a HTTP GET request?
A. request.open(“GET”,”data”);
B. request.open(GET,”data.csv”);
C. request.open(“GET”,”data.csv”);
D. request.open(“GET”);
Solution: The code that begins a HTTP GET request for the contents of the specified URL is
request.open("GET","data.csv");
To send a request to a server open() and send() methods of the XMLHttpRequest object are used.

You Have Score    /10